<template>
    <view>
        <cu-custom bgColor="bg-white" isBack="true">
            <block slot="content" class="text-000 text-black text-bold">电影票详情页</block>
        </cu-custom>
        <!-- 电影信息开始 -->
        <view class="bg-white margin-top-sm padding-top margin-lr-sm radius">

            <!--电影院信息-->
            <view class="flex margin-left justify-between">
                <view class="text-bold">{{order.cinema.cinema_name}}</view>
                <view class="text-red margin-right" v-if="order.paid===1">{{order.ticket_status_info}}</view>
            </view>

            <!--票排期信息-->
            <view class="flex margin-top margin-left padding-bottom">
                <view>
                    <view class="text-bold text-lg margin-bottom text-black">{{order.schedule.show_name}}</view>
                    <view class="text-gray text-sm">
                        <view class="margin-bottom-xs">{{order.schedule.mark}}</view>
                        <view>{{order.schedule.show_mark}} {{order.seat_names}}</view>
                    </view>
                </view>
            </view>
        </view>
        <!-- 电影信息结束 -->

        <!-- 二维码 -->
        <view class="bg-white margin-lr-sm margin-top-sm padding-tb-sm radius" v-if="ordere.paid===1 && order.ticket_contents">
            <view class="margin-left text-bold margin-top">影票二维码</view>
            <view class="padding-tb">

                <!--取票二维码-->
                <view class=" flex justify-center">
                    <img :src="order.ticket_contents.qrcode" style="width:290rpx;height:290rpx;margin:32rpx auto"/>
                </view>

                <!--取票号类型-->
                <view class="text-gray bg-gray margin-lr-lg margin-top text-center padding radius" v-if="order.ticket_contents.type===0">
                    取票号
                    <text class="text-black text-bold margin-top">{{order.ticket_contents.code}}</text>
                </view>
                <!--/取票号类型结束-->

                <!--验证码类型-->
                <view v-if="order.ticket_contents.type===1">
                    <view class="text-gray bg-gray margin-lr-lg margin-top text-center padding-tb-xs padding-lr radius margin-lr-auto"
                          style="width: 70%;">
                        <text>订单号：</text>
                        <text class="text-black text-bold margin-top">{{order.ticket_contents.order_id}}</text>
                    </view>
                    <view class="text-gray bg-gray margin-lr-lg margin-top text-center padding-tb-xs padding-lr radius margin-lr-auto"
                          style="width: 70%;">
                        <text>验证码：</text>
                        <text class="text-black text-bold margin-top">{{order.ticket_contents.code}}</text>
                    </view>
                </view>
                <!--/验证码类型结束-->
            </view>
        </view>
        <!-- 订单号 -->
        <view class="bg-white margin-sm radius">
            <!--订单号-->
            <view class="flex justify-between solid-bottom padding-tb">
                <view class="margin-left">订单号</view>
                <view class="margin-right">{{order.order_id}}</view>
            </view>

            <!--下单时间-->
            <view class="flex justify-between solid-bottom padding-tb">
                <view class="margin-left">下单时间</view>
                <view class="margin-right">{{order.add_time_info}}</view>
            </view>

            <!-- 总价 -->
            <view class="flex justify-between margin-top padding-bottom">
                <view class="margin-left">总价</view>
                <view class="margin-right">
                    <text class="text-gray margin-right-xs">共{{order.total_num}}张,</text>
                    <text>￥{{order.total_price}}</text>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                options: '',
                order: ''
            }
        },
        computed: {},
        async onLoad(options) {
            this.options = options
            let res = await this.$api.orderDetail({orderId: this.options.orderId})
            this.order = res.data
        },
        methods: {
            //支付
            // async pay(){
            //     let res = await this.$api.orderPay({orderId:this.options.orderId});
            //     console.log('获取支付参数')
            //     console.log(res)
            //     console.log(res.data.result.jsConfig)
            //
            //     this.$thirdApi.pay(res.data.result.jsConfig).then(res=>{
            //         //支付成功
            //         if(res){
            //             console.log('支付成功')
            //         }else{
            //             console.log('支付失败')
            //         }
            //     })
            // }
        }
    }
</script>

<style>
    .order_img {
        width: 35 rpx;
        height: 30 rpx
    }
</style>
